package com.rayc.mall.pay.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rayc.mall.common.result.PageDTO;
import com.rayc.mall.common.result.Result;
import com.rayc.mall.pay.domain.po.PayOrder;
import com.rayc.mall.pay.domain.query.PayOrderPageQuery;
import com.rayc.mall.pay.service.IPayOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Ray-C
 * @CreateTime: 2025-03-26
 * @Description: 管理员支付订单管理相关接口
 * @Version: 1.0
 */
@Slf4j
@Api(tags = "管理员支付订单管理相关接口")
@RestController
@RequestMapping("/admin/pay-orders")
@RequiredArgsConstructor
public class AdminPayController {
    private final IPayOrderService payOrderService;

    @ApiOperation("分页查询支付订单")
    @GetMapping("/page")
    public Result<PageDTO<PayOrder>> queryPayOrderByPage(PayOrderPageQuery query) {
        log.info("分页查询支付订单 {}", query);
        Page<PayOrder> pageResult = payOrderService.search(query);
        PageDTO<PayOrder> result = PageDTO.of(pageResult, PayOrder.class);
        log.info("分页查询支付订单结果 {}", result);
        return Result.success(result);
    }
}
